package com.hxic.zc.controller;


import com.hxic.zc.domain.Student;
import com.hxic.zc.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("mp")
public class StudentController {
    @Autowired
    StudentService service;

    @RequestMapping("query")
    @ResponseBody
    public String query() {

        List<Student> list = service.list();
        System.out.println(list);
        return null;
    }

    @RequestMapping("add")
    @ResponseBody
    public String add() {
        Student st = new Student();
        st.setName("ccc");
        st.setSno("1111");
        service.save(st);

        return null;
    }
}